/*************************************************************************
	> File Name: config.c
	> Author: Maureen 
	> Mail: 1437867946@qq.com 
	> Created Time: Sat 27 Mar 2021 06:26:31 PM CST
 ************************************************************************/

#include "head.h"

int get_config(const char *file, struct Config *config) {
    FILE *fp = NULL;
    if ((fp = fopen(file, "rb")) == NULL) {
        return -1;
    }
    //read to string
    //string to json

    //TODO: read data from json, and fill the struct 
    strcpy(config->master_ip, "123.57.102.65");
    config->master_port = 8001; 
    config->worker_size = 3;
    config->inter_time.cpu.time = 5;
    config->inter_time.cpu.type = 1;
    config->inter_time.mem.time = 10;
    config->inter_time.mem.type = 2;
    config->inter_time.disk.time = 120;
    config->inter_time.disk.type = 3;
    config->inter_time.proc.time = 10;
    config->inter_time.proc.type = 4;
    config->inter_time.sys.time = 240;
    config->inter_time.sys.type = 5;
    config->inter_time.user.time = 600;
    config->inter_time.user.type = 6;
    return 0;
}
